package it.low.game.client.server;

import it.low.game.core.element.ActiveElement;
import it.low.game.core.location.MapPoint;
import it.low.game.core.message.ClientEvent;
import it.low.game.core.message.ElementState;
import it.low.game.core.message.PlayerEvent;
import it.low.game.server.client.ServerClientInterface;
import it.low.game.server.client.ServerClientInterfaceImpl;

import java.util.Collection;
import java.util.Set;

public class ClientServerInterfaceImpl implements ClientServerInterface {
	
	ServerClientInterface serverClientInterface = null;
	
	public int init(long clientId){
		serverClientInterface = new ServerClientInterfaceImpl();
		return serverClientInterface.init(clientId);
	}
	
	public void close(long clientId){
		serverClientInterface.close(clientId);
	}
	
	// SEND EVENTS TO THE SERVER
	
	public void sendClientEvent(ClientEvent clientEvent){
		serverClientInterface.receiveClientEvent(clientEvent);
	}
	
	public void sendPlayerEvent(PlayerEvent playerEvent){
		serverClientInterface.receivePlayerEvent(playerEvent);
	}
	
	// RECEIVE THE WORLD STATE FROM THE SERVER
	
	public void receiveWorldState(long elapsedTime){
		serverClientInterface.sendWorldState(elapsedTime);
	}
	
	public ElementState receivePlayerState(long playerId){
		return serverClientInterface.sendPlayerState(playerId);
	}
	
	public Set<ElementState> receiveElementsState(long playerId){
		return serverClientInterface.sendElementsState(playerId);
	}
	
	// TO START THE GAME METHODS
	
	public ActiveElement loadPlayer(long clientId){
		return serverClientInterface.loadPlayer(clientId);
	}
	
	public String[][] loadMap(){
		return serverClientInterface.loadMap();
	}
	
	public Collection<ActiveElement> loadBots(){
		return serverClientInterface.loadBots();
	}
	
	public ActiveElement initPlayer(long playerId, int size, MapPoint mapPosition){
		return serverClientInterface.initPlayer(playerId, size, mapPosition);
	}
	
	public ActiveElement initBot(long botId, int size){
		return serverClientInterface.initBot(botId ,size);
	}
		
}
